<template>
  <el-container>
    <el-main class='main'>
      <el-empty description="暂无数据" v-if='testlist.length==0'>
        <el-button type="text" @click='gettestlist()'><i class="el-icon-refresh-right">点击刷新</i></el-button>
      </el-empty>
      <div v-for="(item,index) in testlist" :key='index' style="overflow: hidden;">
        <Exampaper :test_paper='item'></Exampaper>
      </div>
    </el-main>
    <changepwd v-if='this.$store.state.changepwd==1' class="changepwd-border"></changepwd>
  </el-container>
</template>

<script>
  import Exampaper from './library/Exampaper'
  import changepwd from './library/Pop.vue'
  import Vue from 'vue'
  export default {
    name: 'index',
    components: {
      Exampaper,
      changepwd
    },
    data() {
      return {
        testlist: []
      }
    },
    mounted: function() {
      // this.$store.state.changepwd = this.$route.query.changepwd
      Vue.prototype.$webwidth = document.body.clientWidth
      this.gettestlist()

    },
    methods: {
      gettestlist() {
        this.$getRequest({
            url: '/testPaper/stuGetTest'
          }).then(res => {
            if (res.code === 200) {
              this.testlist = res.data
            } else {
              this.$alert(res.msg, '提示', {
                confirmButtonText: '确定',
                customClass: 'message_box_alert'
              })
            }
          })
          .catch(failResponse => {});
      }
    }
  }
</script>
<style scoped>
  .main {
    background-color: #ffffff;
    overflow: hidden;
  }

  .message_box_alert {
    width: 80vw;
  }

  .changepwd-border {
    border-radius: 20px;
  }
</style>
